import fetch from '@/utils/fetch'

//拉取资产分类列表
export function getAssetsClassList(){
	return fetch({
		url:"/property/v1/mgt/category",
		method:"get"
	})
}

//新增资产分类
export function addAssetsClass(data){
	return fetch({
		url:"/property/v1/mgt/category",
		method:"post",
		data
	})
}

//修改节点信息
export function updateAssetsClass(category_id,data){
	return fetch({
		url:`/property/v1/mgt/category/${category_id}`,
		method:"patch",
		data
	})
}

//禁用节点
export function noAssetsClass(category_id){
	return fetch({
		url:`/property/v1/mgt/category/${category_id}`,
		method:"post"
	})
}

//删除节点
export function deleteAssetsClass(category_id){
	return fetch({
		url:`/property/v1/mgt/category/${category_id}`,
		method:"delete"
	})
}

//拉取模板信息
export function getTemplate(){
	return fetch({
		url:"/property/v1/mgt/tag/template",
		method:"get"
	})
}

//编辑模板信息
export function updateTemplate(data){
	return fetch({
		url:"/property/v1/mgt/tag/template",
		method:"post",
		data
	})
}

//拉取条码规则信息
export function getTagRule(){
	return fetch({
		url:"/property/v1/mgt/tag/rule",
		method:"get"
	})
}

//编辑条码规则信息
export function updateTagRule(data){
	return fetch({
		url:"/property/v1/mgt/tag/rule",
		method:"post",
		data
	})
}

//拉取资产管理员列表
export function getAdmin(params){
	return fetch({
		url:"/property/v1/mgt/admin",
		method:"get",
		params
	}) 
}

//新增资产管理员
export function addAdmin(data){
	return fetch({
		url:"/property/v1/mgt/admin",
		method:"post",
		data
	})
} 

//编辑资产管理员
export function upadteAdmin(admin_id,data){
	return fetch({
		url:`/property/v1/mgt/admin/${admin_id}`,
		method:"patch",
		data
	})
}

//删除资产管理员
export function deleteAdmin(admin_id){
	return fetch({
		url:`/property/v1/mgt/admin/${admin_id}`,
		method:"delete"
	})
}

//查询资产管理员详细
export function getAdminDetail(admin_id){
	return fetch({
		url:`/property/v1/mgt/admin/${admin_id}`,
		method:"get"
	})
}

//拉取资产列表
export function getAssetsList(params){
	return fetch({
		url:"/property/v1/mgt/info",
		method:"get",
		params
	})
}

//新增资产
export function addAssets(data){
	return fetch({
		url:"/property/v1/mgt/info",
		method:"post",
		data
	})
}

//根据区域拉取管理员
export function getAdminForArea(area_id){
	return fetch({
		url:`/property/v1/mgt/admin/inarea/${area_id}`,
		method:"get"
	})
}

//根据id查询资产详细
export function getAssetsDetail(property_id){
	return fetch({
		url:`/property/v1/mgt/info/${property_id}`,
		method:"get"
	})
}

//编辑资产信息
export function updateAssets(property_id,data){
	return fetch({
		url:`/property/v1/mgt/info/${property_id}`,
		method:"patch",
		data
	})
}

//添加维修信息
export function addRepair(data){
	return fetch({
		url:"/property/v1/mgt/repair",
		method:"post",
		data
	})
}

//拉取维修登记列表
export function getRepairList(params){
	return fetch({
		url:"/property/v1/mgt/repair",
		method:"get",
		params
	})
}

//拉取维修信息详细
export function getRepair(repair_id){
	return fetch({
		url:`/property/v1/mgt/repair/${repair_id}`,
		method:"get"
	})
}

//编辑维修信息
export function updateRepair(repair_id,data){
	return fetch({
		url:`/property/v1/mgt/repair/${repair_id}`,
		method:"patch",
		data
	})
}

//资产借出
export function lendAsset(data){
	return fetch({
		url:`/property/v1/mgt/lend`,
		method:"post",
		data
	})
}

//资产归还
export function backAsset(data){
	return fetch({
		url:`/property/v1/mgt/back`,
		method:"post",
		data
	})
}

//查询借用归还记录
export function lendbackAsset(params){
	return fetch({
		url:`/property/v1/mgt/record/lend_back`,
		method:"get",
		params
	})
}

//资产领用
export function inAsset(data){
	return fetch({
		url:`/property/v1/mgt/user/in`,
		method:"post",
		data
	})
}

//资产退库
export function outAsset(data){
	return fetch({
		url:`/property/v1/mgt/user/out`,
		method:"post",
		data
	})
}

//查询领用退库记录
export function receiveAsset(params){
	return fetch({
		url:`/property/v1/mgt/record/receive`,
		method:"get",
		params
	})
}

//资产调拨
export function transferAsset(data){
	return fetch({
		url:`/property/v1/mgt/transfer`,
		method:"post",
		data
	})
}

//查询调拨记录
export function recordReceiveAsset(params){
	return fetch({
		url:`/property/v1/mgt/record/transfer`,
		method:"get",
		params
	})
}

//资产报废还原
export function invalidAsset(data,action){
	return fetch({
		url:`/property/v1/mgt/invalid/${action}`,
		method:"post",
		data
	})
}

//查询报废还原记录
export function invalidAssetList(params){
	return fetch({
		url:`/property/v1/mgt/record/invalid`,
		method:"get",
		params
	})
}